@import "../themes/default";
@import "./hairline";
@import "./icon";

@listPrefixCls: vm-list;
@inputPrefixCls: vm-input;

.input-loop-label-span(@n, @i:1) when (@i <= @n) {
  .@{inputPrefixCls}-label-@{i} {
    width: @i * @input-label-width;
  }
  .input-loop-label-span(@n, (@i + 1));
}

.@{listPrefixCls}-item {
  &.@{inputPrefixCls}-item {
    height: @list-item-height;
    padding-left: @h-spacing-lg;
  }

  &:not(:last-child) {
    .@{listPrefixCls}-line {
      .hairline('bottom');
    }
  }

  .@{inputPrefixCls}-label {
    color: @color-text-base;
    font-size: @font-size-heading;
    margin-left: 0;
    margin-right: @h-spacing-sm;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    padding: 2 * @hd 0;
    &-center {
      text-align: center;
    }
    &-right {
      text-align: right;
    }
  }

  .input-loop-label-span(10);

  .@{inputPrefixCls}-control {
    font-size: @input-font-size;
    flex: 1;

    input, textarea {
      color: @color-text-base;
      font-size: @font-size-heading;
      appearance: none;
      width: 100%;
      padding: 2 * @hd 0;
      border: 0;
      background-color: transparent;
      line-height: @line-height-base*1.2;
      box-sizing: border-box;

      &::placeholder {
        color: @color-text-placeholder;
      }

      &:disabled {
        color: @color-text-disabled;
        background-color: #fff;
      }
    }

    textarea {
      resize: none;
    }
  }

  .@{inputPrefixCls}-clear {
    display: none;
    width: @icon-size-sm;
    height: @icon-size-sm;
    border-radius: @radius-circle;
    overflow: hidden;
    font-style: normal;
    color: @fill-base;
    background-color: @input-color-icon;
    background-repeat: no-repeat;
    .encoded-svg-background('input_item_delete');

    background-size: @icon-size-sm auto;
    background-position: 2 * @hd 2 * @hd;

    &-active {
      background-color: @input-color-icon-tap;
    }
  }

  &.@{inputPrefixCls}-focus {
    .@{inputPrefixCls}-clear {
      display: block;
    }
  }

  .@{inputPrefixCls}-extra {
    flex: initial;
    min-width: 0;
    max-height: @icon-size-sm;
    overflow: hidden;
    padding-right: 0;
    line-height: @line-height-base;
    color: @color-text-caption;
    font-size: @font-size-subhead;
    margin-left: @h-spacing-sm;
  }

  &.@{inputPrefixCls}-error {
    .@{inputPrefixCls}-control {
      input {
        color: @brand-error;
      }
    }

    .@{inputPrefixCls}-error-extra {
      height: @icon-size-sm;
      width: @icon-size-sm;
      margin-left: @v-spacing-sm;
      .encoded-svg-background('error');

      background-size: @icon-size-sm auto;
    }
  }

  &.@{inputPrefixCls}-disabled {
    .@{inputPrefixCls}-label {
      color: @color-text-disabled;
    }
  }
}
